<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?><!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/favicon.ico" >
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/public/js/html5shiv.js"></script>
    <script type="text/javascript" src="/public/js/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/Hui-iconfont/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="/public/plugins/h-ui.admin/css/style.css" />
    <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="/public/js/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>快方管理后台</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <style type="text/css">
    </style>
</head>
<body>
<div class="cl pd-10">
    <form  method="post"  class="form form-horizontal" id="demoform">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">平台名称：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <input type="text" id="tl" value="<?php if($info){echo $info['TL'];}  ?>" class="input-text" autocomplete="off" placeholder="平台名称">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">权重：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <input type="text" class="input-text" autocomplete="off" id="qz" value="<?php if($info){echo $info['QZ'];}  ?>" placeholder="权重：数字">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">唯一标识：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <input type="text" class="input-text" autocomplete="off" id="un" value="<?php if($info){echo $info['UNIQUE'];}  ?>" placeholder="唯一标识">
                <span style="color: red">注：平台名称首字母，如（蜂鸟配送：fn）</span>
            </div>
        </div>
        <input type="hidden" value="<?php if($info){echo $info['ID'];}  ?>" id="ptid">
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input data-url="/Delivery/add" class="btn btn-primary radius" id="button" type="button" value="提交">

            </div>
        </div>
    </form>
</div>
<script src="http://webapi.amap.com/maps?v=1.3&key=30d49820c57fa434f5a8783322b817a8&plugin=AMap.PolyEditor,AMap.CircleEditor"></script>

<script type="text/javascript" src="/public/js/jquery.min.js"></script>
<script type="text/javascript" src="/public/plugins/layer/layer.js"></script>
<script type="text/javascript" src="/public/plugins/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/public/plugins/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="/public/plugins/jquery.contextmenu/jquery.contextmenu.r2.js"></script>
<script type="text/javascript">
    $("#button").click(function(){
        var _this = $(this);
        if(_this.hasClass('disabled')){
            return false;
        }
        _this.addClass('disabled').text('正在添加');
        var tl = $("#tl").val();
        var qz = $("#qz").val();
        var un = $("#un").val();
        var url = _this.data('url');
        var ptid = $("#ptid").val();
        if(tl==""){
            alert("名称不能为空");
            _this.removeClass('disabled').text("提交")
            return false;
        }
        if(isNaN(qz)){
            alert("权重必须为数字");
            _this.removeClass('disabled').text("提交");
            return false;
        }
        if(qz==""){
            alert("权重不能为空");
            _this.removeClass('disabled').text("提交")
            return false;
        }
        if(un==""){
            alert("标识不能为空");
            _this.removeClass('disabled').text("提交")
            return false;
        }
        $.ajax({
            type: "POST",
            url: url,
            data: {tl:tl,qz:qz,un:un,ptid:ptid},
            dataType:"json",
            success: function(msg){
                if(msg.code==200){
                    alert('添加成功');
                    parent.window.location.reload();
                    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                    parent.layer.close(index);
                }else{
                    alert(msg.msg);
                    _this.removeClass('disabled').text("提交")
                }
            }
        });


    })
</script>
</body>
</html>
